﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Controls;
using System.Windows.Data;
using System.Windows.Documents;
using System.Windows.Input;
using System.Windows.Media;
using System.Windows.Media.Imaging;
using System.Windows.Navigation;
using System.Windows.Shapes;
using System.Windows.Media.Animation;

namespace agile_tool.userControl
{
    /// <summary>
    /// Interaction logic for sprintItem.xaml
    /// </summary>
    public partial class sprintItem : UserControl
    {
        public int id;
        public sprintItem()
        {
            InitializeComponent(); tbDesc.IsEnabled = false; tbName.IsEnabled = false; dpStartDate.IsEnabled = false;	
         thisState = states.Closed;
        }
        public enum states {editOpen,viewOpen,Closed }
        public states thisState;
      public void openView()
        {
           
                Storyboard rtt = (Storyboard)Resources["openTheDesc"];
                rtt.Begin();
            
            thisState = states.viewOpen;
        }

        public void closeTheDesc()
        {
            
                Storyboard rtt = (Storyboard)Resources["closeTheDesc"];
                rtt.Begin();
                tbDesc.IsEnabled = false;
                tbName.IsEnabled = false;
                dpStartDate.IsEnabled = false;

                thisState = states.Closed;
        }

        public void openTheDesc()
        {
            
                Storyboard rtt = (Storyboard)Resources["openTheDesc"];
                rtt.Begin();
                tbDesc.IsEnabled = true;
                tbName.IsEnabled = true;
                dpStartDate.IsEnabled = true;
                thisState = states.editOpen;
        }

        private void btnView_Click(object sender, RoutedEventArgs e)
        {
            if(thisState == states.Closed)
                 openView();
            else if (thisState == states.viewOpen)
                closeTheDesc();
            else
                MessageBox.Show("Save Changes First");

        }
        
    }
}
